Conversation
This comment has been minimized.
This comment has been minimized.
Source commit: python/typeshed@11ff7e1
This is allegedly causing large performance problems, see 13821 typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing to undo. Patching this in typeshed also feels weird, since there's a more general soundness issue. If a typevar has a bound or constraint, we might not want to solve it to a Literal. If we can confirm the performance regression or fix the unsoundness within mypy, I might pursue upstreaming this in typeshed. (Reminder: add this to the sync_typeshed script once merged)
The plugin provides superior type checking: python#13987 (comment) A manual cherry-pick of e437cdf.
|
Diff from mypy_primer, showing the effect of this PR on open source code: prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/deployments/flow_runs.py:441: error: Argument 1 to "sleep" has incompatible type "float | None"; expected "float" [arg-type]
+ src/prefect/deployments/flow_runs.py:441: error: Argument 1 to "sleep" has incompatible type "float | None"; expected "float | SupportsIndex" [arg-type]
- src/prefect/infrastructure/provisioners/container_instance.py:274: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ src/prefect/infrastructure/provisioners/container_instance.py:274: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- src/prefect/infrastructure/provisioners/container_instance.py:275: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ src/prefect/infrastructure/provisioners/container_instance.py:275: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- src/prefect/infrastructure/provisioners/container_instance.py:347: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ src/prefect/infrastructure/provisioners/container_instance.py:347: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- src/prefect/infrastructure/provisioners/container_instance.py:356: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ src/prefect/infrastructure/provisioners/container_instance.py:356: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- src/prefect/infrastructure/provisioners/container_instance.py:413: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ src/prefect/infrastructure/provisioners/container_instance.py:413: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- src/prefect/infrastructure/provisioners/container_instance.py:638: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ src/prefect/infrastructure/provisioners/container_instance.py:638: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- src/prefect/cli/deploy/_actions.py:165: note: def __setitem__(self, slice[Any, Any, Any], Iterable[dict[str, Any]], /) -> None
+ src/prefect/cli/deploy/_actions.py:165: note: def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[dict[str, Any]], /) -> None
- src/prefect/cli/deploy/_actions.py:193: note: def __setitem__(self, slice[Any, Any, Any], Iterable[dict[str, Any]], /) -> None
+ src/prefect/cli/deploy/_actions.py:193: note: def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[dict[str, Any]], /) -> None
- src/prefect/cli/deploy/_actions.py:201: note: def __setitem__(self, slice[Any, Any, Any], Iterable[dict[str, Any]], /) -> None
+ src/prefect/cli/deploy/_actions.py:201: note: def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[dict[str, Any]], /) -> None
- src/prefect/cli/deploy/_actions.py:220: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[dict[str, Any]]
+ src/prefect/cli/deploy/_actions.py:220: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[dict[str, Any]]
pydantic (https://github.com/pydantic/pydantic)
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1065: note: "evaluate_forward_ref" defined here
+ ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1068: note: "evaluate_forward_ref" defined here
mypy-protobuf (https://github.com/dropbox/mypy-protobuf)
+ mypy_protobuf/main.py:358: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
+ mypy_protobuf/main.py:1447: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
django-test-migrations (https://github.com/wemake-services/django-test-migrations)
+ django_test_migrations/signals.py:10: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_routedef.py:151:6: error: Signature of "__getitem__" incompatible with supertype "typing.Sequence" [override]
+ aiohttp/web_routedef.py:151:6: note: Superclass:
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, int, /) -> AbstractRouteDef
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Sequence[AbstractRouteDef]
+ aiohttp/web_routedef.py:151:6: note: Subclass:
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, int, /) -> AbstractRouteDef
+ aiohttp/web_routedef.py:151:6: note: @overload
+ aiohttp/web_routedef.py:151:6: note: def __getitem__(self, slice[int, int, int], /) -> list[AbstractRouteDef]
+ aiohttp/test_utils.py:561:2: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
+ aiohttp/pytest_plugin.py:157:2: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
+ aiohttp/pytest_plugin.py:187:2: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
colour (https://github.com/colour-science/colour)
- colour/models/tests/test_hunter_rdab.py:159: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_rdab.py:159: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hunter_rdab.py:294: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_rdab.py:294: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hunter_lab.py:233: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_lab.py:233: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hunter_lab.py:368: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hunter_lab.py:368: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_ipt.py:230: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_ipt.py:230: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_ipt.py:337: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_ipt.py:337: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_cie_lab.py:251: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_cie_lab.py:251: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_hdr_cie_lab.py:376: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_hdr_cie_lab.py:376: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_uvw.py:133: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_uvw.py:133: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_uvw.py:243: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_uvw.py:243: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:148: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:148: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:258: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:258: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:368: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:368: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:485: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:485: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:710: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:710: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_luv.py:823: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_luv.py:823: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_lab.py:133: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_lab.py:133: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/tests/test_cie_lab.py:243: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/tests/test_cie_lab.py:243: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/rgb/tests/test_rgb_colourspace.py:477: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/rgb/tests/test_rgb_colourspace.py:477: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/models/rgb/tests/test_rgb_colourspace.py:677: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/models/rgb/tests/test_rgb_colourspace.py:677: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/colorimetry/tests/test_whiteness.py:475: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/colorimetry/tests/test_whiteness.py:475: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/colorimetry/tests/test_whiteness.py:574: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/colorimetry/tests/test_whiteness.py:574: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:215: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:215: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:404: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:404: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:406: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:406: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_scam.py:407: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_scam.py:407: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_rlab.py:155: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_rlab.py:155: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_nayatani95.py:155: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_nayatani95.py:155: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:223: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:223: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:224: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:224: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:225: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:225: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:434: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:434: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:435: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:435: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:438: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:438: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_llab.py:441: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_llab.py:441: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:223: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:223: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:224: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:224: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:225: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:225: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:434: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:434: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:435: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:435: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:438: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:438: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_kim2009.py:441: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_kim2009.py:441: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hunt.py:231: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hunt.py:231: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hunt.py:236: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hunt.py:236: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hunt.py:238: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hunt.py:238: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:242: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:242: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:243: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:243: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:449: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:449: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:452: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:452: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:455: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:455: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_hellwig2022.py:456: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_hellwig2022.py:456: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:264: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:264: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:265: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:265: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:465: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:465: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:468: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:468: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:471: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:471: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam16.py:472: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
+ colour/appearance/tests/test_ciecam16.py:472: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[float]
- colour/appearance/tests/test_ciecam02.py:205: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[float]
... (truncated 43 lines) ...
mypy (https://github.com/python/mypy)
+ mypy/server/aststrip.py:140: error: Unused "type: ignore" comment [unused-ignore]
operator (https://github.com/canonical/operator)
- ops/model.py:885: error: Argument 1 of "__contains__" is incompatible with supertype "typing.Container"; supertype defines the argument type as "object" [override]
- ops/model.py:932: error: Argument 1 of "__contains__" is incompatible with supertype "typing.Container"; supertype defines the argument type as "object" [override]
- ops/model.py:1961: error: Argument 1 of "__contains__" is incompatible with supertype "typing.Container"; supertype defines the argument type as "object" [override]
- ops/model.py:2402: error: Argument 1 of "__contains__" is incompatible with supertype "typing.Container"; supertype defines the argument type as "object" [override]
- ops/framework.py:1385: note: def __getitem__(self, slice[Any, Any, Any], /) -> MutableSequence[Any]
+ ops/framework.py:1385: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> MutableSequence[Any]
- ops/framework.py:1385: note: def __getitem__(self, slice[Any, Any, Any], /) -> Sequence[Any]
+ ops/framework.py:1385: note: def __getitem__(self, slice[int | None, int | None, int | None], /) -> Sequence[Any]
- ops/framework.py:1388: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Any], /) -> None
+ ops/framework.py:1388: note: def __setitem__(self, slice[int | None, int | None, int | None], Iterable[Any], /) -> None
- ops/framework.py:1392: note: def __delitem__(self, slice[Any, Any, Any], /) -> None
+ ops/framework.py:1392: note: def __delitem__(self, slice[int | None, int | None, int | None], /) -> None
core (https://github.com/home-assistant/core)
+ homeassistant/components/script/trace.py:25: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
+ homeassistant/components/fjaraskupan/coordinator.py:134: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/file_upload/__init__.py:37: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
+ homeassistant/components/amcrest/__init__.py:202: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/amcrest/__init__.py:213: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/improv_ble/config_flow.py:297: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/homekit/__init__.py:981: error: Unused "type: ignore" comment [unused-ignore]
+ homeassistant/components/shelly/config_flow.py:844: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/homeassistant_hardware/helpers.py:281: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/homeassistant_hardware/util.py:127: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/homeassistant_hardware/util.py:167: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/homeassistant_hardware/util.py:368: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
+ homeassistant/components/zha/radio_manager.py:172: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.AsyncIterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._AsyncGeneratorContextManager[_T_co`-2, None] of function contextlib.asynccontextmanager is deprecated: Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. Use `-> AsyncGenerator[Foo]` instead. [deprecated]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/subtests.py:287: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
+ src/_pytest/subtests.py:316: error: overload def [_P, _T_co] (func: def (*_P.args, **_P.kwargs) -> typing.Iterator[_T_co`-2]) -> def (*_P.args, **_P.kwargs) -> contextlib._GeneratorContextManager[_T_co`-2, None, None] of function contextlib.contextmanager is deprecated: Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead. [deprecated]
urllib3 (https://github.com/urllib3/urllib3)
+ test/test_collections.py:336: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_collections.py:337: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_collections.py:398: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_collections.py:399: error: Unused "type: ignore" comment [unused-ignore]
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:242: note: def __setitem__(self, slice[Any, Any, Any], Iterable[Embed], /) -> None
+ discord/http.py:242: note: def __setitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], Iterable[Embed], /) -> None
- ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1046: note: "update" of "TypedDict" defined here
+ ...venv/lib/python3.14/site-packages/mypy/typeshed/stdlib/typing.pyi:1049: note: "update" of "TypedDict" defined here
ibis (https://github.com/ibis-project/ibis)
- ibis/legacy/udf/vectorized.py:188: error: Incompatible types in assignment (expression has type "Attribute", variable has type "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index[Any] | Series[Any] | SequenceNotStr[Hashable]") [assignment]
+ ibis/legacy/udf/vectorized.py:188: error: Incompatible types in assignment (expression has type "Attribute", variable has type "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index[Any] | Series[Any] | SequenceNotStr[Hashable] | tuple[Hashable, ...]") [assignment]
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_tests/test_instrumentation.py:40: error: Unsupported operand types for in ("Task | None" and "Container[Task]") [operator]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/refs.py:127: error: Unused "type: ignore" comment [unused-ignore]
+ dulwich/refs.py:129: error: Unused "type: ignore" comment [unused-ignore]
+ dulwich/refs.py:131: error: Unused "type: ignore" comment [unused-ignore]
+ dulwich/refs.py:140: error: Unused "type: ignore" comment [unused-ignore]
+ dulwich/refs.py:142: error: Unused "type: ignore" comment [unused-ignore]
scipy (https://github.com/scipy/scipy)
- scipy/spatial/transform/_rotation_xp.py:539: error: Invalid index type "tuple[EllipsisType, None, None]" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ scipy/spatial/transform/_rotation_xp.py:539: error: Invalid index type "tuple[EllipsisType, None, None]" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- scipy/spatial/transform/_rigid_transform_xp.py:300: error: Invalid index type "tuple[EllipsisType, None]" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ scipy/spatial/transform/_rigid_transform_xp.py:300: error: Invalid index type "tuple[EllipsisType, None]" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- scipy/spatial/transform/_rigid_transform_xp.py:301: error: Invalid index type "tuple[EllipsisType, None]" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ scipy/spatial/transform/_rigid_transform_xp.py:301: error: Invalid index type "tuple[EllipsisType, None]" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
manticore (https://github.com/trailofbits/manticore)
- tests/wasm/json2mc.py:103: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
+ tests/wasm/json2mc.py:103: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[Any]
apprise (https://github.com/caronc/apprise)
- apprise/config/base.py:795: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ apprise/config/base.py:795: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- apprise/config/base.py:804: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ apprise/config/base.py:804: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- apprise/config/base.py:806: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ apprise/config/base.py:806: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- apprise/config/base.py:811: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ apprise/config/base.py:811: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- apprise/config/base.py:816: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ apprise/config/base.py:816: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- apprise/config/base.py:823: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ apprise/config/base.py:823: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/rpc/telegram.py:408: note: def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/rpc/telegram.py:408: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes
- freqtrade/rpc/telegram.py:408: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ freqtrade/rpc/telegram.py:408: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- freqtrade/rpc/telegram.py:409: note: def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/rpc/telegram.py:409: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes
- freqtrade/rpc/telegram.py:409: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ freqtrade/rpc/telegram.py:409: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- freqtrade/templates/FreqaiExampleStrategy.py:287: note: def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/templates/FreqaiExampleStrategy.py:287: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes
- freqtrade/templates/FreqaiExampleStrategy.py:287: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ freqtrade/templates/FreqaiExampleStrategy.py:287: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
- freqtrade/templates/FreqaiExampleStrategy.py:290: note: def __getitem__(self, slice[Any, Any, Any], /) -> bytes
+ freqtrade/templates/FreqaiExampleStrategy.py:290: note: def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes
- freqtrade/templates/FreqaiExampleStrategy.py:290: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
+ freqtrade/templates/FreqaiExampleStrategy.py:290: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" [index]
|
Mypy primer hits
|
|
Do you think python/typeshed#12087 is worth it, especially without any linter autofix support in the ecosystem? Want to leave this open for a bit to see if any other maintainer's have opinions on it |
Yes, I think so. The return type for context managers is actually something I struggled with myself for quite some time. I couldn't really find any information only if it should be In the end it's also a fairly simple and strait forward thing to fix. E.g. this was my PR for Home Assistant: home-assistant/core#162144 If |
Source commit:
python/typeshed@11ff7e1